home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / QUEUE.H < prev    next >
C/C++ Source or Header  |  1993-04-27  |  977b  |  37 lines

  1. #ifndef QUEUE_H
  2. #define QUEUE_H
  3.  
  4. #include "object.h"
  5.  
  6. class Object;
  7. class ArrayOb;
  8.  
  9. const unsigned QUEUE_DEFAULT_CAPACITY    = 16;
  10. const unsigned QUEUE_EXPANSION_INCREMENT = 32;
  11.  
  12. ////////////////////////////////////////////////////////////
  13. // class Queue (declaration)
  14. ////////////////////////////////////////////////////////////
  15. class Queue : public Object
  16. {
  17.     ArrayOb     *pContents;
  18.     int         readPosition;
  19.     int         writePosition;
  20.     void        makeRoomForWrite();
  21. public:
  22.                 // constructors, destructors
  23.                 Queue(int sz=QUEUE_DEFAULT_CAPACITY);
  24.  
  25.     Object*                 next();
  26.     Object*                 nextPut(const Object& ob);
  27.     unsigned                capacity() const;
  28.     unsigned                size() const;
  29.     void                    printOn(ostream& strm) const;
  30.     void                    state() const;  //diagnostic
  31.     virtual const Class*    isA() const;
  32. };
  33.  
  34. #endif
  35.  
  36.  
  37.